DG-100: Read in bulk mode when we can.
authorrobertl <robertl>
Tue, 12 Feb 2008 18:58:05 +0000 (18:58 +0000)
committerrobertl <robertl>
Tue, 12 Feb 2008 18:58:05 +0000 (18:58 +0000)
Mac/Linux serial: don't reset timeout as often to trigger fewer driver bugs.
Lowrance: add read support for v3 files.
WBT doc: update.

dg-100.c
gbser_posix.c
lowranceusr.c
xmldoc/formats/wbt-bin.xml
xmldoc/formats/wbt.xml

index 02877cee0f3868101072c712dd7bc1247b03f916..046369674df28225857918c4c25ec3c0b84c14b2 100644 (file)
--- a/dg-100.c
+++ b/dg-100.c
@@ -3,7 +3,7 @@
     GlobalSat DG-100 GPS data logger download.
 
     Copyright (C) 2007  Mirko Parthey, mirko.parthey@informatik.tu-chemnitz.de
-    Copyright (C) 2005  Robert Lipe, robertlipe@usa.net
+    Copyright (C) 2005-2008  Robert Lipe, robertlipe@gpsbabel.org
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -432,10 +432,19 @@ dg100_recv_frame(struct dg100_command **cmdinfo_result, gbuint8 **payload)
 
        /* TODO: Since we know how long the frame should be, we could try to
         * read the rest of the frame at once using gbser_read_wait(). */
+#if 0
        for (i = 7; i < frame_len; i++) {
                buf[i] = dg100_recv_byte();
                dg100_debug("", 0, 1, &buf[i]);
        }
+#else
+       i = gbser_read_wait(serial_handle, &buf[7], frame_len - 7, 1000);
+       dg100_debug("", 0, frame_len - 7, &buf[7]);
+       if (i < frame_len - 7) {
+               fatal("Expected to read %d bytes, but got %d\n", 
+                       frame_len - 7, i);
+       }
+#endif
 
        frame_start_seq   = be_read16(buf + 0);
        payload_len_field = be_read16(buf + 2);
index c2c6cab3c663f42bfdac14c180dbc899dd554df3..4667ffce3d4a5e8e7b8f2e731f911ab93eebd78a 100644 (file)
@@ -305,7 +305,16 @@ int gbser__fill_buffer(void *handle, unsigned want, unsigned *ms) {
                     vmin  = want - h->inbuf_used;
                     vtime = (unsigned) time_left / 100;
                 }
-                if ((rc = set_rx_timeout(h, vmin, vtime), rc < 0) ||
+               // The commented out call to set_rx_timeout here is totally
+               // legal by POSIX standards but does result in a flurry of
+               // of tcsetattrs that slightly tweak VMIN/VTIME while there
+               // is incoming data.   This has been shown to trigger driver
+               // bugs in the Prolific drivers for Mac and in certain Linux
+               // kernels, thought the latter has since been fixed.  
+               // So althogh removing this means that the timeout behaviour
+               // is actually different on POSIX and WIN32, it triggers
+               // fewer buts this way.  2/12/2008 RJL
+                if (/* (rc = set_rx_timeout(h, vmin, vtime), rc < 0) || */
                     (rc = read(h->fd, h->inbuf + h->inbuf_used, 
                                       want - h->inbuf_used), rc < 0)) {
                     return gbser_ERROR;
index 86394ca415e5b89287bb7c6154afeef125313416..b7a11b0af9570a0af78c9cb4f9cb812f5c956394 100644 (file)
@@ -2,7 +2,7 @@
        Access to Lowrance USR files.
        Contributed to gpsbabel by Jason Rust (jrust at rustyparts.com)
 
-       Copyright (C) 2005, 2006 Robert Lipe, robertlipe@usa.net
+       Copyright (C) 2005, 2006, 2007, 2008 Robert Lipe, robertlipe@usa.net
 
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
@@ -176,6 +176,7 @@ static char *ignoreicons;
 static char *writeasicons;
 static char *merge;
 static char *seg_break;
+static int reading_version;
 
 #define MYNAME "Lowrance USR"
 
@@ -368,6 +369,11 @@ lowranceusr_parse_waypt(waypoint *wpt_tmp)
        if (global_opts.debug_level >= 1)
                printf(MYNAME " parse_waypt: waypt_type = %d\n",waypt_type);
 
+    // Version 3 has an extra word in here that we don't know about.
+    if (reading_version >= 3) {
+      int junkword = gbfgetint32(file_in);
+      (void)junkword;
+    }
 }
 
 
@@ -558,6 +564,7 @@ data_read(void)
        int i;
 
        MajorVersion = gbfgetint16(file_in);
+       reading_version = MajorVersion;
        MinorVersion = gbfgetint16(file_in);
        
        if (global_opts.debug_level >= 1)
index 94509a517e5cd2e64b5373e44e881daec8d0f1fd..86782266477f5436a8b3ccde85cde61e189e7fd2 100644 (file)
@@ -1,8 +1,8 @@
 <para>File protocol for the <productname>Wintec WBT-200</productname>
-GPS data logger. This format reads the binary file format created
+and <productname>Wintec WBT-201</productname> (sometimes called the <productname> G-Rays 2</productname>)GPS data loggers. This format reads the binary file format created
 by Wintec's Windows application.</para>
 <para>
-<ulink url="http://www.semsons.com/wi3mugpsrebt.html">Wintec WBT-200 </ulink>
+<ulink url="http://www.semsons.com/wiwbmu3gpsre2.html">Wintec WBT-201 </ulink>
 </para>
 <example id="wbt-bin-on-macos">
   <title>Command showing conversion of a Wintec binary file to GPX</title>
index fb6a9625629bb24dd3333cb056769bc7790d394c..8a18450775370f8192ae2f5f06da8de2bad98eae 100644 (file)
@@ -1,9 +1,26 @@
-<para>Serial download protocol for the <productname>Wintec WBT-200</productname> GPS data logger. Although untested it is expected that this will also support the WBT-100.</para>
+<para>Serial download protocol for the 
+<productname>Wintec WBT-200</productname>  and
+<productname>Wintec WBT-201</productname> 
+GPS data loggers. Although untested it is expected that this will also support the WBT-100.</para>
 <para>
-<ulink url="http://www.semsons.com/wi3mugpsrebt.html">Wintec WBT-200</ulink>
+<ulink url="http://www.semsons.com/wiwbmu3gpsre2.html">Wintec WBT-201</ulink>
 </para>
 <example id="wbt-on-macos">
   <title>Command showing WBT-200 download and erase over Bluetooth on Mac OS X</title>
   <para><userinput>gpsbabel -t -w -i wbt,erase -f /dev/cu.WBT200-SPPslave-1 -o gpx -F out.gpx</userinput></para>
 </example>
-    
+
+<para>
+Internally, this is actually a serial device that has a serial/USB adapter
+built into it.  It uses the CP210x chip by Silicon labs.   You will probably
+need a driver for this chip.  The product ships with one for Windows.  
+The Linux 210x driver seems to work fine.  Mac users will need to download 
+the <ulink url="http://www.silabs.com/tgwWebApp/public/web_content/products/Microcontrollers/USB/en/mcu_vcp.htm">Mac driver for CP210x</ulink>.
+</para>
+
+<para>
+GPSBabel does not try to offer an interface to configure these units. That
+is left to the Windows software that comes with it or tools like the 
+<ulink url="http://www.daria.co.uk/gps">WBT 201 Viewer</ulink> for Mac OS/X
+and Linux.
+</para>